package com.hefu.virtuallife.ui.purchase.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.hefu.virtuallife.R;
import com.hefu.virtuallife.ui.purchase.bean.RecordPointBean;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * creat_user: zhengzaihong
 * Email:1096877329@qq.com
 * creat_date: 2018/6/24
 * creat_time: 11:35
 * describe 积分记录
 **/
public class RecordPointAdapter extends BaseAdapter {


    private Context mContext;

    private List<RecordPointBean> listdata;

    public RecordPointAdapter(Context mContext,List<RecordPointBean> listdata) {
        this.mContext = mContext;
        this.listdata = listdata;
    }


    @Override
    public int getCount() {
        return null==listdata?0:listdata.size();
    }

    @Override
    public Object getItem(int position) {
        return null==listdata?"":listdata.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;
        if (null == convertView) {
            convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.itme_activity_point_record, null);
            viewHolder = new ViewHolder(convertView);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }


        return convertView;
    }

     class ViewHolder {
        @BindView(R.id.tv_name)
        TextView tvName;
        @BindView(R.id.tv_time)
        TextView tvTime;
        @BindView(R.id.tv_point)
        TextView tvPoint;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
